package messages;

import java.awt.EventQueue;
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import GUI.ReadComplaints;
import controllers.CustomerController;
import controllers.DBConnection;
import controllers.WorkerController;
import entity.UserLoginInfo;
import ocsf.server.ConnectionToClient;

public class ComplaintMessage {

	String[] userArr;
	ConnectionToClient client;
	WorkerController workerC;
	CustomerController customerC;
	UserLoginInfo loginInfo;
	SimpleDateFormat dateTime = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
	java.sql.Timestamp date;
	
	
	public ComplaintMessage(String[] strMsg, ConnectionToClient client){
		this.userArr=strMsg;
		this.client=client;
	}
	
	public void activation(){
		dateTime.format(date);
		String Complaint=userArr[1];
		System.out.println("date: "+ dateTime);
	
		try{
			Statement stmt;
			DBConnection conn=new DBConnection();
			java.sql.PreparedStatement pr1= conn.getDBConnection().prepareStatement("SELECT * " + "FROM sgi_system.users " + "WHERE ID ='" + userArr[1]+"' AND Password='" + userArr[2]+"';");
			ResultSet rs=pr1.executeQuery();			
			
			if(!rs.next()){
				pr1.close();
				rs.close();
				System.out.println("No match between id and password that inserted in DB");
	
			}
		
		}catch (Exception e)
	       {
	    	   e.printStackTrace();
	       
	       }
	
}
}